01004c72ba306ac104cdd74ed20934dfb59222e9,core/src/test/java/org/elasticsearch/common/rounding/TimeZoneRoundingTests.java,TimeZoneRoundingTests,testTimeUnitRoundingDST,#,150

Before Change


        assertThat(tzRounding.nextRoundingValue(time("2014-03-30T02:00:00", DateTimeZone.forOffsetHours(1))),
                equalTo(time("2014-03-30T03:00:00", DateTimeZone.forOffsetHours(1))));

        tzRounding = TimeZoneRounding.builder(DateTimeUnit.HOUR_OF_DAY).timeZone(DateTimeZone.forID("CET")).build();
        assertThat(tzRounding.round(time("2014-03-30T01:01:01", DateTimeZone.forOffsetHours(1))),  // CET = UTC+1
                equalTo(time("2014-03-30T01:00:00", DateTimeZone.forOffsetHours(1))));
        assertThat(tzRounding.nextRoundingValue(time("2014-03-30T01:00:00", DateTimeZone.forOffsetHours(1))),
                equalTo(time("2014-03-30T02:00:00", DateTimeZone.forOffsetHours(1))));
        assertThat(tzRounding.nextRoundingValue(time("2014-03-30T02:00:00", DateTimeZone.forOffsetHours(1))),
                equalTo(time("2014-03-30T03:00:00", DateTimeZone.forOffsetHours(1))));

        // testing non savings to savings switch (America/Chicago)
        tzRounding = TimeZoneRounding.builder(DateTimeUnit.HOUR_OF_DAY).timeZone(DateTimeZone.forID("UTC")).build();
        assertThat(tzRounding.round(time("2014-03-09T03:01:01", DateTimeZone.forID("America/Chicago"))),
                equalTo(time("2014-03-09T03:00:00", DateTimeZone.forID("America/Chicago"))));

        tzRounding = TimeZoneRounding.builder(DateTimeUnit.HOUR_OF_DAY).timeZone(DateTimeZone.forID("America/Chicago")).build();
        assertThat(tzRounding.round(time("2014-03-09T03:01:01", DateTimeZone.forID("America/Chicago"))),
                equalTo(time("2014-03-09T03:00:00", DateTimeZone.forID("America/Chicago"))));

After Change


    public void testTimeUnitRoundingDST() {
        Rounding tzRounding;
        // testing savings to non savings switch
        DateTimeZone cet = DateTimeZone.forID("CET");
        tzRounding = TimeZoneRounding.builder(DateTimeUnit.HOUR_OF_DAY).timeZone(cet).build();
        assertThat(tzRounding.round(time("2014-10-26T01:01:01", cet)), isDate(time("2014-10-26T01:00:00+02:00"), cet));
        assertThat(tzRounding.nextRoundingValue(time("2014-10-26T01:00:00", cet)),isDate(time("2014-10-26T02:00:00+02:00"), cet));